package com.pashanhoo.Thread.pool;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * 测试手写简易的线程池
 *
 * @author 胡庆安
 * @version V1.0
 * @Package com.pashanhoo.Thread.pool
 * @date 2020/10/23 10:54
 * @Copyright © 2010-2020 爬山虎科技（扬州）股份有限公司
 */
public class TestPool {

    public static void main(String[] args) {
        Logger log = LoggerFactory.getLogger(Test.class);

        HqaPool pool = new HqaPool(1, 1, 1000, TimeUnit.MILLISECONDS);


        for (int i = 0; i < 4; i++) {
            int j = i;
            pool.execute(() -> {
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                log.debug("{}", j);
            });
        }
    }
}


